// 告诉你properties中的键和值是否包含在object中。
//返回对象是否具有给定的“键：值”对集合。

import { Io } from "./extendOwn"

export default function isMatch(object: Io, attrs: Io) {
  var keys = Object.keys(attrs)
  var length = keys.length
  if (object == null) return false
  var obj = Object(object)
  for (var i = 0; i < length; i++) {
    var key = keys[i]
    if (attrs[key] !== obj[key] || !(key in obj)) return false
  }
  return true
}

/*
var stooge = {name: 'moe', age: 32};
  isMatch(stooge, {age: 32});
*/